// components/musiclist/musiclist.js
const app = getApp()
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    musiclist: {
      type:Array
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    playingId: -1,
  },
  pageLifetimes: {
    show() {
      // 取全局app.js中的musicId 高亮显示
      // app.getPlayMusicId()
      this.setData({
        // 由于musicId的类型不一样
        playingId: parseInt(app.getPlayMusicId())
      })
    }
  },
  /**
   * 组件的方法列表
   */
  methods: {
    onSelect(event) {
      // console.log(event.currentTarget.dataset.musicid,"被选中");
      const ds = event.currentTarget.dataset;
      let musicid = ds.musicid;
      this.setData({
        playingId: musicid
      })
      wx.navigateTo({
        url: `/pages/player/player?musicId=${musicid}&index=${ds.index}`,
      })
    }
  }
})
